<?php
require_once ($_SERVER['DOCUMENT_ROOT'] . '/common/all_setup_first.php');
require_once ($_SERVER['DOCUMENT_ROOT'] . '/class/db/DB.php');
require_once ($_SERVER['DOCUMENT_ROOT'] . '/class/other/Message.php');
require_once ($_SERVER['DOCUMENT_ROOT'] . '/class/util/Pager.php');
require_once ($_SERVER['DOCUMENT_ROOT'] . '/common/function_common.php');

if (!$is_login){
	//未登录
	exit;
}
$page = intval($_GET['p']);
$view_cnt = 10;
$block_cnt = 10;


$obj_conn = new DB();
$obj_Message = new Message();

unset($arr_input);
$arr_input['baby_id'] = $login_id;
$arr_input['message_type'] = 2;
$arr_input['cnt'] = 1;
$message_cnt = $obj_Message->getMessageList($obj_conn,$arr_input);
$extend_url = '';
$obj_Pager = new Pager($page,$message_cnt[0][0],$extend_url,$view_cnt,$block_cnt);
unset($arr_input);
$arr_input['baby_id'] = $login_id;
$arr_input['message_type'] = 2;
$arr_message_list = $obj_Message->getMessageList($obj_conn,$arr_input);//,$obj_Pager->getLimitQuery()
?>

<?php

				for ($i=0,$int_count=count($arr_message_list);$i<$int_count;$i++){
				    $int_id = $arr_message_list[$i][0];
				    $int_baby_id = $arr_message_list[$i][1];
				    $int_baby_fid = $arr_message_list[$i][2];
				    $str_friend_name = $arr_message_list[$i][3];
				    $int_message_type = $arr_message_list[$i][4];
				    $str_title = $arr_message_list[$i][5];
				    $str_message = $arr_message_list[$i][6];
				    $int_read_type = $arr_message_list[$i][7];
				    $str_create_date = $arr_message_list[$i][8];
				    
				    if (utf8_strlen($str_title) > 12){
				        $str_short_title = utf8_substr($str_title,12) . '...';
				    }else{
				        $str_short_title = $str_title;
				    }
				    	    
				    echo '<tr>';
				    echo '<td><input type="checkbox" id="message_',$int_id,'" value="',$int_id,'" class="hidden"/><img src="/images/checkbox_off.gif" onclick="setCheckbox(\'message_',$int_id,'\')" style="cursor:hand"/></td>';
				    echo '<td><a href="read.php?id=',$int_id,' & message_type=2">',$str_short_title,'</a></td>';
				    echo '<td class="name"><a href="#">',$str_friend_name,'</a></td>';
				    echo '<td>',$str_create_date,'</td>';
				    echo '<td><img src="/images/icon_delete.gif" onclick="deleteMessage(',$int_id,');" style="cursor:hand"/></td>';
				    echo '</tr>';
				}
				?>